<?php

/* @var $this \yii\web\View */
/* @var $content string */

use app\assets\AppAsset;
use yii\helpers\Url;

?>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=oFH2SXCDdzEwYCTFCnbTEuzw73KIFrpU"></script>


        <style type="text/css">
            body, html {width: 100%;height: 100%;margin:0;font-family:"微软雅黑";}
            #allmap{width:100%;height:500px;}
            p{margin-left:5px; font-size:14px;}
        </style>




        <!--nav-->
		<div class="page content">
        <!--<div style="text-align:center"><button class="btn_point">获取point</button></div>      
        <div class="point" style="text-align:center"></div>-->
        <div id="allmap" style="width:100%; height:80%"></div>
            <a href="<?=Url::to(['/h5cargo/index/rentalcarorderdetails'])?>" class="bottn" style="    margin: 2rem auto 2rem auto;width: 80%;display: block" >返回</a>


    </div>

<script>
    var baidu_longitude = my.getUrlParam('baidu_longitude');
    var baidu_atitude = my.getUrlParam('baidu_atitude');
    var stores_phone = my.getUrlParam('stores_phone');
    var stores_address = my.getUrlParam('stores_address');
    var stores_name = my.getUrlParam('stores_name');
    // 百度地图API功能
    var map = new BMap.Map("allmap");

    var infoWindowIsopen=false;
    var pt = new BMap.Point(121.390497,31.213938);
    //var myIcon = new BMap.Icon("http://developer.baidu.com/map/jsdemo/img/fox.gif", new BMap.Size(300,157));
    var marker2 = new BMap.Marker(pt);  // 创建标注,{icon:myIcon}
    var opts = {
        width : 200,     // 信息窗口宽度
        height: 100,     // 信息窗口高度
        title : stores_name+'('+stores_phone+')' , // 信息窗口标题
        enableMessage:true//设置允许信息窗发送短息
    };
    var infoWindow = new BMap.InfoWindow("地址："+ stores_address+" ", opts);  // 创建信息窗口对象
    map.centerAndZoom(pt, 15);
    map.addEventListener("tilesloaded",function(){
        console.log(map);
        //map.openInfoWindow(infoWindow,point); //开启信息窗口
        map.addOverlay(marker2);
        map.openInfoWindow(infoWindow,pt); //开启信息窗口
    });
    marker2.addEventListener("click", function(){
        if(infoWindowIsopen)
            infoWindow.close();
        else
            map.openInfoWindow(infoWindow,pt); //开启信息窗口
        infoWindowIsopen=!infoWindowIsopen;
    });

    //创建小狐狸

    // h5_show_point(31.213938,121.390497,'t','s');
    // 百度地图API功能
    /*
    var map = new BMap.Map("allmap");
    var point = new BMap.Point(116.417854,39.921988);
    var marker = new BMap.Marker(point);  // 创建标注
    map.addOverlay(marker);              // 将标注添加到地图中

    map.centerAndZoom(point, 15);
    var opts = {
        width : 200,     // 信息窗口宽度
        height: 100,     // 信息窗口高度
        title : stores_name+'('+stores_phone+')' , // 信息窗口标题
        enableMessage:true//设置允许信息窗发送短息
    }
    var infoWindow = new BMap.InfoWindow("地址："+ stores_address+" ", opts);  // 创建信息窗口对象
    map.openInfoWindow(infoWindow,point); //开启信息窗口
    marker.addEventListener("click", function(){
        map.openInfoWindow(infoWindow,point); //开启信息窗口
    });
    */

</script>